<script>
import {data} from "autoprefixer";

export default {
  name:'login',
  data() {
    return {
      labelPosition: 'right',
      user: {
        username: '',
        userpass: '',
      },
      msg:''
    };
  },
  methods:{
    login(){
      this.$axios.get("/admin/login",{
        params:{
          adminName:this.user.username,
          adminPass:this.user.userpass
        }
      }).then(data=>{
        if (data.data.code==200){
          localStorage.setItem("token",data.data.data)
          this.$router.push("/")
        }else {
          alert("登录失败")
        }
      })
    }
  }
}
</script>

<template>
  <div>
    <div class="herder">
      <p style="color: forestgreen;font-size: 20px">欢迎来到铁路12306管理员登录</p>
      <img class="minpic" src="./herder.png">
    </div>
    <img style="width: 100%" class="pic" src="./lb1.jpg">
    <el-form class="login" :label-position="labelPosition" label-width="80px" :model="user">
      <el-form-item label="账号">
        <el-input v-model="user.username" placeholder="请输入账号" style="width: 400px"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input type="password" v-model="user.userpass" placeholder="请输入密码" style="width: 400px"></el-input>
      </el-form-item>
<!--      <div><a href="http://localhost:8080/#/regist">注册账号</a>|忘记密码?</div>-->
      <el-button type="primary" @click="login">立即登录</el-button>
      <el-button>取消登录</el-button><br/>
      <span style="color: red">{{msg}}</span>
    </el-form>
  </div>
</template>

<style>
.login{
margin-left: 1300px;
  background-color: gold;
  width: 500px;
  margin-top: -400px;


}
.minpic{
  width: 250px;
  margin-right: 1600px;
  margin-top: -80px;
}
.foot{
  margin-top: 180px;
}






</style>
